package emulator.GUI.display;

import java.util.HashMap;

public class VicDisplayRegistry {
	private static HashMap<String, VicDisplay> registry = new HashMap<String, VicDisplay>();
	
	public static void registerDisplay(String name, VicDisplay display)
	{
		synchronized(registry) {
			registry.put(name, display);
			registry.notifyAll();
		}
	}
	
	static VicDisplay findDisplay(String name)
	{
		synchronized(registry) {
			return registry.get(name);
		}
	}

	public static VicDisplay waitDisplay(String name)
	{
		synchronized(registry) {
			try {
				while (!registry.containsKey(name))
					registry.wait();
			} catch (InterruptedException e) { }
			return registry.get(name);
		}
	}
}
